home *** CD-ROM | disk | FTP | other *** search
/ Merciful 5 / Merciful - Disc 5.iso / software / r / real_3d / real3dv3.3b.dms / real3dv3.3b.adf / RPL.LZH / RPL / saturnus.rpl < prev    next >
Text File  |  1995-04-18  |  4KB  |  202 lines

  1.  
  2. ( Creates a saturnus planet with rings consisting of particles
  3. ( ------------------------------------------------------------
  4.  
  5. 6.28    FCONSTANT PI2
  6.  
  7. "rpl/sys/locks.rpl" LOAD
  8.  
  9. ( Material for planet 
  10.  
  11. : CreMaterial
  12.  
  13.     iLOCK_EXCL MAT_LOCK
  14.  
  15.     "planet" ( name )
  16.     0 ( specularity )
  17.     25 ( specbright )
  18.     0 ( brilliancy )
  19.     0 ( transparency )
  20.     0 ( turbidity )
  21.     0 ( refraction )
  22.     0 ( currindex )
  23.     100 ( effectiveness )
  24.     0 ( density )
  25.     0 ( roughness )
  26.     204 ( flags )
  27.     46 ( turbidpower )
  28.     6 ( method )
  29.     0 ( handler )
  30.     0 ( txt_freqx )
  31.     0 ( txt_freqy )
  32.     0 ( sp_x )
  33.     0 ( sp_y )
  34.     1 ( sp_w )
  35.     1 ( sp_h )
  36.     "" ( handler_prg )
  37.     "marble1" ( picture )
  38.     0 0 0 0 ( transp.color )
  39.     5 ( bumph )
  40.     0 ( ditherscale )
  41.     0 ( scopehandler )
  42.     "" ( scopeexpr )
  43.     0 ( scope1 )
  44.     0 ( scope2 )
  45.     0 ( tcoorhandler )
  46.     "" ( tcoorexpr )
  47.     0 ( tco1 )
  48.     0 ( tco2 )
  49.     0 ( bumphandler )
  50.     "" ( bumpexpr )
  51.     0 ( bmp1 )
  52.     0 ( bmp2 )
  53.     0 ( colorhandler )
  54.     "" ( colorexpr )
  55.     0 ( co1 )
  56.     0 ( co2 )
  57.     0 ( indexhandler )
  58.     "" ( indexexpr )
  59.     0 ( id1 )
  60.     0 ( id2 )
  61.     "CEND"
  62.     MAT_CREATE DROP
  63.  
  64.     iLOCK_REMOVE MAT_LOCK
  65. ;
  66.  
  67. ( see rpl/sys/objects.rpl
  68. 2 2  POW CONSTANT lOF_WFINVISIBLE ( Invisible wire frames
  69.  
  70. ( This function creates the actual planet
  71.  
  72. : CrPlanet 
  73.     PARAM
  74.         FVARIABLE fPlanetSize
  75.     ENDPARAM
  76.  
  77.     2 "planet" 0 "CEND" C_LEVEL O_CURRENT DROP
  78.  
  79.         0 0 0               ( center
  80.         fPlanetSize FFETCH 0 0     ( a
  81.         0 fPlanetSize FFETCH 0     ( b
  82.         0 0 fPlanetSize FFETCH     ( c
  83.         255 255 255 0 ( RGBA )
  84.         "planet" 
  85.         0 
  86.         "CEND"
  87.         C_ELLIPSOID DROP
  88.  
  89.         0 0 0               ( center
  90.         fPlanetSize FFETCH 0 0     ( a
  91.         0 fPlanetSize FFETCH 0     ( b
  92.         0 0 fPlanetSize FFETCH     ( c
  93.         255 255 255 0 ( RGBA )
  94.         "planet" ( name )
  95.         2048     ( flags = texture )
  96.         "CEND"
  97.         "planet" "SMAT"
  98.         C_ELLIPSOID DROP
  99.  
  100.     O_GETCURR O_GETPAR O_CURRENT DROP
  101. ;
  102.  
  103. ( This creates one particle in given position
  104.  
  105. : CrParticle 
  106.     PARAM
  107.         VVARIABLE vCenter
  108.         FVARIABLE fPartSize
  109.         VARIABLE iWireFrames
  110.         VARIABLE iRed
  111.         VARIABLE iGreen
  112.         VARIABLE iBlue
  113.     ENDPARAM
  114.  
  115.     vCenter VFETCH
  116.     fPartSize FFETCH 0 0       ( a )
  117.     0 fPartSize FFETCH 0       ( b )
  118.     0 0 fPartSize FFETCH       ( c )
  119.  
  120.     iRed FETCH iGreen FETCH iBlue FETCH 0 ( RGBA )
  121.     "particle" 
  122.     iWireFrames FETCH 
  123.     IF
  124.         0
  125.     ELSE
  126.         lOF_WFINVISIBLE
  127.     ENDIF
  128.     "CEND"
  129.     C_ELLIPSOID DROP
  130. ;
  131.  
  132.  
  133. ( Computes radius for particle in question
  134.  
  135. : CrRad 
  136.     PARAM
  137.         VARIABLE iCircOrd
  138.         FVARIABLE fPartSize
  139.     FVARIABLE fPlanetSize
  140.     ENDPARAM
  141.  
  142.     iCircOrd FETCH fPartSize FFETCH 4 F* F* fPlanetSize FFETCH 1.5 F* F+
  143.     fPartSize FFETCH 0.3 F* RANDOM F* F+
  144. ;
  145.  
  146.  
  147. ( Computes angle for particle in question
  148.  
  149. : CrAngle 
  150.     PARAM
  151.         VARIABLE iPartOrd
  152.         VARIABLE iPartCnt
  153.     ENDPARAM
  154.  
  155.     iPartOrd FETCH iPartCnt FETCH F/ PI2 F* PI2 iPartCnt FETCH F/ RANDOM F* F+
  156. ;
  157.  
  158. : CrSaturnus
  159.     PARAM
  160.         VARIABLE iPartCnt
  161.         VARIABLE iCircCnt
  162.         FVARIABLE fPartSize
  163.         FVARIABLE fPlanetSize
  164.         VARIABLE iWireFrames
  165.         VARIABLE iRed
  166.         VARIABLE iGreen
  167.         VARIABLE iBlue
  168.     ENDPARAM
  169.  
  170.     CreMaterial
  171.  
  172.     iLOCK_EXCL O_LOCK
  173.  
  174.     ( create planet
  175.     fPlanetSize FFETCH CrPlanet
  176.  
  177.     ( create rings
  178.     2 "rings" 0 "CEND" C_LEVEL O_CURRENT DROP
  179.  
  180.     iCircCnt FETCH 0 
  181.     DO
  182.         iPartCnt FETCH 0 
  183.         DO
  184.             I iPartCnt FETCH CrAngle SIN J fPartSize FFETCH fPlanetSize FFETCH CrRad F*
  185.             I iPartCnt FETCH CrAngle COS J fPartSize FFETCH fPlanetSize FFETCH CrRad F*
  186.             fPartSize FFETCH RANDOM F*
  187.             fPartSize FFETCH 
  188.             iWireFrames FETCH
  189.             iRed FETCH
  190.             iGreen FETCH
  191.             iBlue FETCH
  192.             CrParticle
  193.         LOOP
  194.     LOOP
  195.     iLOCK_REMOVE O_LOCK
  196. ;
  197.  
  198. CrSaturnus
  199.  
  200. FORGET PI2
  201.  
  202.